Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrease time-to-sync for learn-only devices joining the network #11271

Merged
merged 6 commits into from
Sep 26, 2023

Conversation

vkWeb
Copy link
Member

@vkWeb vkWeb commented Sep 19, 2023

Summary

Decreases the time-to-sync for learn-only devices joining the network by playing with some task's priorities.

Developed together with @akolson ❤️

References

Closes #11220.

Reviewer guidance

Make sure the if condition is as specified in #11220.


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... SIZE: small labels Sep 19, 2023
@vkWeb vkWeb marked this pull request as ready for review September 19, 2023 16:26
@vkWeb vkWeb requested review from bjester and akolson September 19, 2023 16:27
@vkWeb
Copy link
Member Author

vkWeb commented Sep 19, 2023

@bjester @akolson ready to review and merge 🎉

Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple things. Other than that looks good!

@vkWeb
Copy link
Member Author

vkWeb commented Sep 25, 2023

@bjester @akolson ready for final review - merge 🎉

@vkWeb vkWeb requested a review from bjester September 25, 2023 16:30
Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

mock_enqueue.assert_called_once_with(
job_id="9e89d3ea5256721c9cd631eac36feafe",
args=(self.mock_broadcast.id, self.instance.to_dict()),
args=(self.broadcast.id, self.instance.to_dict()),
priority=mock_priority_method(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using mock_priority_method.return_value can be a bit clearer for test assertions, and also as a practice avoids potential gotchas asserting the number of times a mock is called.

},
)

self.broadcast = KolibriBroadcast(instance=self.broadcast_instance)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep using the mock, to keep the unit testing scope limited to the listeners. You can use spec or spec_set on the mock to constrain its usage to align with a particular class, in this case KolibriBroadcast. All that said, the broadcast class doesn't do much without start_broadcast called.

@bjester bjester merged commit d43ab6d into learningequality:release-v0.16.x Sep 26, 2023
@vkWeb
Copy link
Member Author

vkWeb commented Sep 26, 2023

@bjester sir will keep in mind those suggestions for future test creations. Appreciate the detailed review sir, helps me improve ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEV: backend Python, databases, networking, filesystem... SIZE: medium SIZE: small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decrease the time-to-sync for learn-only devices joining the network
2 participants